/*省级js数组*/
var Province_array=["安徽,3551","北京,3682","重庆,7131","福建,3720","甘肃,3824","广东,3938","广西,4101","贵州,4239","海南,4333","河北,4358",
					"黑龙江,4746","河南,4553","湖北,4905","湖南,5036","内蒙古,5638","江苏,5269","江西,5401","吉林,5188","辽宁,5509","宁夏,5761",
					"青海,5793","山西,6030","山东,5856","上海,6299","四川,6339","天津,6609","西藏,6647","新疆,6736","云南,6856","浙江,7018",
					"陕西,6171","台湾,6562","香港,7210","澳门,7211"];
	
/*市级js数组*/               
var City_array=["合肥,3551","芜湖,3551","蚌埠,3551","淮南,3551","马鞍山,3551","淮北,3551","铜陵,3551","安庆,3551","黄山,3551","滁州,3551","阜阳,3551","宿州,3551","巢湖,3551","六安,3551","亳州,3551","池州,3551","宣城,3551",
			   "福州,3720","厦门,3720","莆田,3720","三明,3720","泉州,3720","漳州,3720","南平,3720","龙岩,3720","宁德,3720",
			   "兰州,3824","嘉峪关,3824","金昌,3824","白银,3824","天水,3824","武威,3824","张掖,3824","平凉,3824","酒泉,3824","庆阳,3824","定西,3824","陇南,3824","临夏,3824","甘南,3824",
			   "广州,3938","韶关,3938","深圳,3938","珠海,3938","汕头,3938","佛山,3938","江门,3938","湛江,3938","茂名,3938","肇庆,3938","惠州,3938","梅州,3938","汕尾,3938","河源,3938","阳江,3938","清远,3938","东莞,3938","中山,3938","潮州,3938","揭阳,3938","云浮,3938",
			   "南宁,4101","柳州,4101","桂林,4101","梧州,4101","北海,4101","防城港,4101","钦州,4101","贵港,4101","玉林,4101","百色,4101","贺州,4101","河池,4101",
			   "贵阳,4239","六盘水,4239","遵义,4239","安顺,4239","铜仁,4239","黔西南,4239","毕节,4239","黔东南,4239","黔南,4239",
			   "海口,4333","三亚,4333","其他,4333",
			   "石家庄,4358","唐山,4358","秦皇岛,4358","邯郸,4358","邢台,4358","保定,4358","张家口,4358","承德,4358","沧州,4358","廊坊,4358","衡水,4358",
			   "哈尔滨,4746","齐齐哈尔,4746","鸡西,4746","鹤岗,4746","双鸭山,4746","大庆,4746","伊春,4746","佳木斯,4746","七台河,4746","牡丹江,4746","黑河,4746","绥化,4746","大兴安岭,4746",
			   "郑州,4553","开封,4553","洛阳,4553","平顶山,4553","安阳,4553","鹤壁,4553","新乡,4553","焦作,4553","濮阳,4553","许昌,4553","漯河,4553","三门峡,4553","南阳,4553","商丘,4553","信阳,4553","周口,4553","驻马店,4553",
	       "武汉,4905","黄石,4905","十堰,4905","宜昌,4905","襄樊,4905","鄂州,4905","荆门,4905","孝感,4905","荆州,4905","黄冈,4905","咸宁,4905","随州,4905","恩施,4905",
			   "长沙,5036","株洲,5036","湘潭,5036","衡阳,5036","邵阳,5036","岳阳,5036","常德,5036","张家界,5036","益阳,5036","郴州,5036","永州,5036","怀化,5036","娄底,5036","湘西,5036",
			   "呼和浩特,5638","包头,5638","乌海,5638","赤峰,5638","通辽,5638","鄂尔多斯,5638","呼伦贝尔,5638","兴安盟,5638","锡林郭勒盟,5638","乌兰察布盟,5638","巴彦淖尔盟,5638","阿拉善盟,5638",
			   "南京,5269","无锡,5269","徐州,5269","常州,5269","苏州,5269","南通,5269","连云港,5269","淮安,5269","盐城,5269","扬州,5269","镇江,5269","泰州,5269","宿迁,5269",
			   "南昌,5401","景德镇,5401","萍乡,5401","九江,5401","新余,5401","鹰潭,5401","赣州,5401","吉安,5401","宜春,5401","抚州,5401","上饶,5401",
			   "长春,5188","吉林,5188","四平,5188","辽源,5188","通化,5188","白山,5188","松原,5188","白城,5188","延边,5188",
			   "沈阳,5509","大连,5509","鞍山,5509","抚顺,5509","本溪,5509","丹东,5509","锦州,5509","营口,5509","阜新,5509","辽阳,5509","盘锦,5509","铁岭,5509","朝阳,5509","葫芦岛,5509",
			   "银川,5761","石嘴山,5761","吴忠,5761","固原,5761",
			   "西宁,5793","海东,5793","海北,5793","黄南,5793","海南,5793","果洛,5793","玉树,5793","海西,5793",
			   "太原,6030","大同,6030","阳泉,6030","长治,6030","晋城,6030","朔州,6030","晋中,6030","运城,6030","忻州,6030","临汾,6030","吕梁,6030",
			   "济南,5856","青岛,5856","淄博,5856","枣庄,5856","东营,5856","烟台,5856","潍坊,5856","济宁,5856","泰安,5856","威海,5856","日照,5856","莱芜,5856","临沂,5856","德州,5856","聊城,5856","滨州,5856","菏泽,5856",
			   "成都,6339","自贡,6339","攀枝花,6339","泸州,6339","德阳,6339","绵阳,6339","广元,6339","遂宁,6339","内江,6339","乐山,6339","南充,6339","眉山,6339","宜宾,6339","广安,6339","达州,6339","雅安,6339","巴中,6339","资阳,6339","阿坝,6339","甘孜,6339","凉山,6339",
			   "拉萨,6647","昌都,6647","山南,6647","日喀则,6647","那曲,6647","阿里,6647","林芝,6647",
			   "乌鲁木齐,6736","克拉玛依,6736","吐鲁番,6736","哈密,6736","昌吉,6736","博尔塔拉,6736","巴音郭楞,6736","阿克苏,6736","克孜勒苏,6736","喀什,6736","和田,6736","伊犁,6736","塔城,6736","阿勒泰,6736",
	       "昆明,6856","曲靖,6856","玉溪,6856","保山,6856","昭通,6856","楚雄,6856","红河,6856","文山,6856","思茅,6856","西双版纳,6856","大理,6856","德宏,6856","丽江,6856","怒江,6856","迪庆,6856","临沧,6856",
			   "杭州,7018","宁波,7018","温州,7018","嘉兴,7018","湖州,7018","绍兴,7018","金华,7018","衢州,7018","舟山,7018","台州,7018","丽水,7018",
			   "西安,6171","铜川,6171","宝鸡,6171","咸阳,6171","渭南,6171","延安,6171","汉中,6171","榆林,6171","安康,6171","商洛,6171"];

/*将省级数据加载到下拉框中*/           
function setProvinceSelect(obj,objProvince,objCity)
{  
	var imgNode = document.getElementById("locationText");
	if(obj.value=="中国")
	{
		document.getElementById(objProvince).style.display="inline";
		document.getElementById(objCity).style.display="inline";
		if(imgNode) {
			if(obj.value!=-1 || document.getElementById(objProvince).value!=0 || document.getElementById(objCity).value!=-1) {
				imgNode.style.display="inline";
				imgNode.className = 'error yesOrNo';
			} else {
				imgNode.style.display="inline";
				imgNode.className = 'correct yesOrNo';
			}
		}
		for(var i = 0;i < Province_array.length;i++)
	    {
	        document.getElementById(objProvince).options.add(new Option(Province_array[i].split(",")[0],Province_array[i].split(",")[0]+","+Province_array[i].split(",")[1]),i+1);
	    }
	}
	else
	{ 
		//清空下拉框中省级的数据
	    for(var k=document.getElementById(objProvince).options.length-1;k>=0;k--)
	    {
	        document.getElementById(objProvince).options[k]=null;
	    }
	    document.getElementById(objProvince).options.add(new Option("请选择",-1),-1);
	    
	    //清空下拉框中市级的数据
        for(var k=document.getElementById(objCity).options.length-1;k>=0;k--)
        {
            document.getElementById(objCity).options[k]=null;
        }
        document.getElementById(objCity).options.add(new Option("请选择",-1),-1);
		document.getElementById(objProvince).style.display="none";
		document.getElementById(objCity).style.display="none";
		document.getElementById(objProvince).value="";
		if(imgNode) {
			imgNode.style.display="inline";
			imgNode.className = 'correct yesOrNo';
		}
	}
    if(obj.value==-1)
    {
    	//清空下拉框中省级的数据
	    for(var k=document.getElementById(objProvince).options.length-1;k>=0;k--)
	    {
	        document.getElementById(objProvince).options[k]=null;
	    }
	    document.getElementById(objProvince).options.add(new Option("请选择",-1),-1);
	    
	    //清空下拉框中市级的数据
        for(var k=document.getElementById(objCity).options.length-1;k>=0;k--)
        {
            document.getElementById(objCity).options[k]=null;
        }
        document.getElementById(objCity).options.add(new Option("请选择",-1),-1);
        if(imgNode) {
        	imgNode.style.display="inline";
        	imgNode.className = 'error yesOrNo';
        }
    }
}

/*通过所选省级数据调用所对应的市级数据*/
function setCitySelect(obj,objCity)
{	
	var imgNode = document.getElementById("locationText");
	//省级中若有北京,天津,重庆,上海,台湾，香港，澳门时
    if(obj.options[obj.selectedIndex].text=="北京"||obj.options[obj.selectedIndex].text=="上海"||obj.options[obj.selectedIndex].text=="重庆"||obj.options[obj.selectedIndex].text=="天津"||obj.options[obj.selectedIndex].text=="台湾"||obj.options[obj.selectedIndex].text=="香港"||obj.options[obj.selectedIndex].text=="澳门")
    {
        document.getElementById(objCity).style.display="none";
        //清空下拉框中市级的数据
	    for(var k=document.getElementById(objCity).options.length-1;k>=0;k--)
	    {
	        document.getElementById(objCity).options[k]=null;
	    }
	    document.getElementById(objCity).options.add(new Option("请选择",-1),-1);
	    if(imgNode) {
	    	imgNode.style.display="inline";
			imgNode.className = 'correct yesOrNo';
	    }
        return;
    }
    
	//清空下拉框中市级的数据
    for(var k=document.getElementById(objCity).options.length-1;k>=0;k--)
    {
        document.getElementById(objCity).options[k]=null;
    }
    
	//加载市级JS数据
	if(obj.value != -1) {
	    for(var i=0;i<City_array.length;i++)
	    {
	        if(City_array[i].split(",")[1]==obj.value.split(",")[1])
	        {
	            document.getElementById(objCity).options.add(new Option(City_array[i].split(",")[0],City_array[i].split(",")[0]+","+City_array[i].split(",")[1]),i);
	        }
	    }
	    if(imgNode) {
	    	imgNode.style.display="inline";
			imgNode.className = 'correct yesOrNo';
	    }
    } else {
    	if(imgNode){
			imgNode.style.display="inline";
			imgNode.className = 'error yesOrNo';
		}
    	document.getElementById(objCity).options.add(new Option("请选择",-1),-1);
    }
    document.getElementById(objCity).style.display="inline";
}
